package com.cy.pj.goods.service.impl;

import com.cy.pj.goods.dao.GoodsDao;
import com.cy.pj.goods.pojo.Goods;
import com.cy.pj.goods.service.GoodsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {
    private static final Logger log =//org.slf4j.Logger  (支持log4j,logback)
            LoggerFactory.getLogger(GoodsServiceImpl.class);//org.slf4j.LoggerFactory
    @Autowired
    private GoodsDao goodsDao;

    @Override
    public List<Goods> findGoods() {
        long t1 = System.currentTimeMillis();
        //System.out.println("start "+t1);
        log.info("start: {} ", t1);//这里的{}表示占位符
        List<Goods> list = goodsDao.findGoods();
        long t2 = System.currentTimeMillis();
        //System.out.println("end: "+t2);
        log.info("end: {} ", t2);
        return list;
    }
}